﻿<%@ Page Language="C#" CodeBehind="ManageContacts.aspx.cs" Inherits="Passageways.Modules.Rolodex.Islands.ViewContacts.ManageContacts" %>
<%@ Register TagPrefix="pw" Namespace="Passageways.WebControls" Assembly="Passageways.WebControls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Manage Contacts</title>
	<pw:Theme runat="server" />
</head>
<body class="portalbodytext">
<form runat="server">
	<!-- TODO: Add Page Header, 
		ID is ContactPageHeader, 
		BreadcrumbText is << return to previous page
		Supply a page description and page title
		Do not show the divider
	 -->
	
	<!-- TODO: add a tool bar 
		include a button to add a new category
	-->
	
	<p>
	<!-- TODO: add a PortalMessage
		ID is CtrlMessage
	-->
	</p>

	<asp:Panel ID="PnlAddContacts" runat="server" Visible="false">
		<!-- TODO: add a TextDivider
		Text is "Add New Contact"
		-->
		<table class="portalbodytext" cellspacing="0" cellpadding="2" border="0" width="100%">
			<tr>
				<td style="text-align: right; white-space: nowrap; width: 100px;">Company Name*:</td>
				<td><asp:TextBox ID="txtCompanyName" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Contact Name*:</td>
				<td><asp:TextBox ID="txtPrimaryName" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Contact Phone*:</td>
				<td><asp:TextBox ID="txtPrimaryPhone" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Contact Email*:</td>
				<td><asp:TextBox ID="txtPrimaryEmail" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Contact Category*:</td>
				<td><asp:DropDownList ID="ddlCategories" runat="server" CssClass="portalbodytext" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Fax:</td>
				<td><asp:TextBox ID="txtFax" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Website URL:</td>
				<td><asp:TextBox ID="txtWebsite" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Address Line 1:</td>
				<td><asp:TextBox ID="txtAddress1" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Address Line 2:</td>
				<td><asp:TextBox ID="txtAddress2" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">City:</td>
				<td><asp:TextBox ID="txtCity" runat="server" CssClass="portalbodytext" Width="150px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">State:</td>
				<td><asp:TextBox ID="txtState" runat="server" CssClass="portalbodytext" Width="150px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Zip:</td>
				<td><asp:TextBox ID="txtZip" runat="server" CssClass="portalbodytext" Width="75px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;" valign="top">Additional Notes:</td>
				<td><asp:TextBox ID="txtNotes" runat="server" TextMode="MultiLine" Columns="45" Rows="6" /></td>
			</tr>
			<tr>
				<td colspan="2">*Required</td>
			</tr>
			<tr>
				<td colspan="2">
					<!-- TODO: talk about the PageButtons -->
					<pw:PageButtons runat="server"
						ButtonType="OkCancel"
						OnCancelClick="OnAddContactCancelClick"
						OnPageIncomplete="OnAddContactOkClick" />
				</td>
			</tr>
		</table>
	</asp:Panel>

	<asp:Panel ID="PnlEditContact" runat="server" Visible="false">
		<!-- TODO: add a TextDivider
		Text is "Edit Contact"
		-->
		<table class="portalbodytext" cellspacing="0" cellpadding="2" border="0" width="100%">
			<tr>
				<td style="text-align: right; white-space: nowrap; width: 100px;">Company Name*:</td>
				<td><asp:TextBox ID="txtEditCompanyName" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Name*:</td>
				<td><asp:TextBox ID="txtEditPrimaryName" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Phone*:</td>
				<td><asp:TextBox ID="txtEditPrimaryPhone" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Email*:</td>
				<td><asp:TextBox ID="txtEditPrimaryEmail" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Contact Category*:</td>
				<td><asp:DropDownList ID="ddlEditContactCategory" runat="server" CssClass="portalbodytext" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Website URL:</td>
				<td><asp:TextBox ID="txtEditWebsite" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Address Line 1:</td>
				<td><asp:TextBox ID="txtEditAddress1" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Address Line 2:</td>
				<td><asp:TextBox ID="txtEditAddress2" runat="server" CssClass="portalbodytext" Width="250px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">City:</td>
				<td><asp:TextBox ID="txtEditCity" runat="server" CssClass="portalbodytext" Width="150px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">State:</td>
				<td><asp:TextBox ID="txtEditState" runat="server" CssClass="portalbodytext" Width="150px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Zip:</td>
				<td><asp:TextBox ID="txtEditZip" runat="server" CssClass="portalbodytext" Width="75px" /></td>
			</tr>
			<tr>
				<td style="text-align: right; white-space: nowrap;">Additional Notes:</td>
				<td><asp:TextBox ID="txtEditNotes" runat="server" TextMode="MultiLine" Columns="45" R /></td>
			</tr>
			<tr>
				<td colspan="2">*Required</td>
			</tr>
			<tr>
				<td colspan="2">
					<!-- TODO: talk about the PageButtons -->
					<pw:PageButtons runat="server"
						ButtonType="OkCancel"
						OnCancelClick="OnEditContactCancelClick"
						OnPageIncomplete="OnEditContactOkClick" />
				</td>
			</tr>
		</table>
	</asp:Panel>
	
	<asp:Panel runat="server" ID="PnlContacts">
		<asp:Repeater ID="rptrCategories" runat="server"
			OnItemDataBound="OnCategoryDataBound">
			<ItemTemplate>
				<asp:HiddenField ID="hdnCategoryID" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "ID") %>' />
				<div class="GridTitleRow" style="padding: 2px;"><%# DataBinder.Eval(Container.DataItem, "Name") %></div>
				<asp:DataGrid ID="dgContacts" runat="server"
					AutoGenerateColumns="False"
					CellSpacing="0"
					CellPadding="2"
					CssClass="Grid"
					DataKeyField="ContactID"
					GridLines="None"
					OnDeleteCommand="OnContactDeleteClick"
					OnEditCommand="OnContactEditClick"
					Width="100%">
					<AlternatingItemStyle CssClass="GridAlternatingItemRow" />
					<HeaderStyle CssClass="GridHeaderRow" />
					<ItemStyle CssClass="GridItemRow" VerticalAlign="Top" />
					<Columns>
						<asp:BoundColumn DataField="CompanyName" HeaderText="Company Name" />
						<asp:BoundColumn DataField="ContactName" HeaderText="Contact Name" />
						<asp:BoundColumn DataField="Email" HeaderText="Email" />
						<asp:BoundColumn DataField="Phone" HeaderText="Phone" />
						<asp:BoundColumn DataField="LastUpdateBy" HeaderText="Last Edit By" />
						<asp:BoundColumn DataField="LastUpdateDateTime" DataFormatString="{0:M/d/yyy h:mm tt}" HeaderText="Last Edit On" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
						<asp:TemplateColumn HeaderText="Edit" HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center">
							<ItemTemplate>
								<asp:LinkButton runat="server" CausesValidation="false" CommandName="Edit">
									<asp:Image runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Modules/Rolodex/images/edit.gif" />
								</asp:LinkButton>
							</ItemTemplate>
						</asp:TemplateColumn>
						<asp:TemplateColumn HeaderText="Delete" HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-HorizontalAlign="Center">
							<ItemTemplate>
								<asp:LinkButton runat="server" CausesValidation="false" CommandName="Delete">
									<asp:Image runat="server" ImageAlign="AbsMiddle" ImageUrl="~/Modules/Rolodex/images/delete.gif" onclick="return confirm('Are you sure you want to delete this contact?');" />
								</asp:LinkButton>
							</ItemTemplate>
						</asp:TemplateColumn>
					</Columns>
				</asp:DataGrid>
			</ItemTemplate>
		</asp:Repeater>
	</asp:Panel>

</form>
</body>
</html>